<?php

namespace plugin\admin\app\model;

use plugin\admin\app\model\Base;

/**
 * @property integer $id (主键)
 * @property integer $user_id 用户ID
 * @property integer $aid 抽奖活动
 * @property string $relation_order_no 关联订单号
 * @property string $order_no 订单号
 * @property string $created_time 抽奖时间
 * @property integer $number 抽奖号码牌
 * @property integer $status 状态，0待开奖，1已中奖，2未中奖
 * @property integer $level 几等奖
 * @property string $name 姓名
 * @property string $idcard 身份证号
 * @property string $address_info 地址信息
 * @property string $order_status 订单状态, 0待用户完善信息,1审核中,2审核失败,3待发货,4待收货,5已完成
 * @property string $shipping_time 发货时间
 * @property string $receive_time 收货时间
 */
class UserPrizeDraw extends Base
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'wa_user_prize_draw';

    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $primaryKey = 'id';
    /**
     * Indicates if the model should be timestamped.
     *
     * @var bool
     */
    public $timestamps = false;

    const ORDER_STATUS_WAIT_FINISH = 0;

    const ORDER_STATUS_AUDIT = 1;

    const ORDER_STATUS_AUDIT_FAIL = 2;

    const ORDER_STATUS_WAIT_SEND = 3;

    const ORDER_STATUS_WAIT_RECEIVE = 4;

    const ORDER_STATUS_FINISH = 5;

    const STATUS_WAIT = 0;

    const STATUS_WIN = 1;

    const STATUS_LOSE = 2;

    const ORDER_STATUS_TEXT = [
        self::ORDER_STATUS_WAIT_FINISH => '待用户完善信息',
        self::ORDER_STATUS_AUDIT => '审核中',
        self::ORDER_STATUS_AUDIT_FAIL => '审核失败',
        self::ORDER_STATUS_WAIT_SEND => '待发货',
        self::ORDER_STATUS_WAIT_RECEIVE => '待收货',
        self::ORDER_STATUS_FINISH => '已完成',
    ];

    const STATUS_TEXT = [
        self::STATUS_WAIT => '待开奖',
        self::STATUS_WIN => '已中奖',
        self::STATUS_LOSE => '未中奖',
    ];

    public static function getOrderStatusText($orderStatus)
    {
        return self::ORDER_STATUS_TEXT[$orderStatus] ?? '';
    }

    public static function getStatusText($status)
    {
        return self::STATUS_TEXT[$status] ?? '';
    }
}
